package arq;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;

public abstract class OperacoesArquivo
{

	public static ArrayList<String> Leitura(String str) throws IOException
	{
		ArrayList<String> strings = new ArrayList<String>();
		BufferedReader bfr;

		bfr = new BufferedReader(new FileReader(str));
		while (bfr.ready())
		{
			strings.add(bfr.readLine());
		}
		bfr.close();

		return strings;
	}

	public static void Escrita(String str, ArrayList<String> strings)
			throws IOException
	{

		BufferedWriter bfw;

		bfw = new BufferedWriter(new FileWriter(str));
		bfw.write(strings.get(0));
		for (int i = 1; i < strings.size(); i++)
		{
			bfw.newLine();
			bfw.write(strings.get(i));
		}
		bfw.close();
	}

	public static void Escrita(String str, String string) throws IOException
	{

		BufferedWriter bw;

		bw = new BufferedWriter(new FileWriter(str));
		bw.write(string);
		bw.close();
	}
}